package com.work.work_demo.work8;

import java.util.ArrayList;
import java.util.Collections;

public class Test {
    public static void main(String[] args) {
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student(1,"张三",80));
        students.add(new Student(2,"李四",88.5));
        students.add(new Student(3,"王五",96));
        Collections.sort(students, (o1, o2) -> Double.compare(o1.getScore(),o2.getScore()));
        for (Student student : students) {
            System.out.println(student.getId() + student.getName() + student.getScore());
        }
    }

}
